package com.guaoran.consul.zuul.config;

import com.codahale.metrics.ConsoleReporter;
import com.codahale.metrics.MetricRegistry;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import java.util.concurrent.TimeUnit;

/**
 * @author : 孤傲然
 * @description : metrics
 * @date :2019/11/24 14:50
 */
@Configuration
public class MetricsConfig {
    @Bean
    public MetricRegistry metricRegistry(){
        MetricRegistry registry = new MetricRegistry();
        ConsoleReporter reporter = ConsoleReporter.forRegistry(registry).build();
        reporter.start(300, TimeUnit.SECONDS);
        return registry;
    }
}
